<div ng-controller="RoomsCtrl" ng-init="addAction()" class="sui-form form-horizontal">
    <form name="roomsForm" novalidate>
        <ul class="sui-breadcrumb">
            <li><a href="#/rooms/list">{{rooms.name?rooms.name:'房间'| translate}}</a></li>
            <li class="active">{{rooms.rooms_id?'edit':'add_new' | translate}}</li>
        </ul>
        <div class="control-group">
            <label class="control-label v-top">{{'房间名称'| translate}}：</label>
            <div class="controls">
                <input ng-model="rooms.name" type="text" value="" class="input-xlarge" required>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top"> {{'副标题'| translate}}：</label>
            <div class="controls">
                <input ng-model="rooms.remark" type="text" value="" name="remark" class="input-xlarge">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top">{{'房间图片'| translate}}：</label>
            <div class="controls">
                <ul class="sui-row-fluid">
                    <li class="span2">
                        <div>
                            <img ng-src="{{rooms.img}}" style="width:600px;height: 170px">
                        </div>
                        <label>
                            <br/> 链接：
                            <input ng-model="rooms.img" type="text" name="name" value="" style="width:100px">
                            <attachment owner-id="rooms.rooms_id ?rooms.rooms_id:1" owner-type="rooms" dhf-ng-model="rooms.img" xtype="url" mult="false" title="Upload" use-type="png,jpeg,gif,jpg,JPG,PNG,JPEG,GIF"></attachment>
                        </label>
                    </li>
                    <li class="span2">
                        <div>
                            <img ng-src="{{rooms.img1}}" style="width:600px;height: 170px">
                        </div>
                        <label>
                            <br/> 链接：
                            <input ng-model="rooms.img1" type="text" name="name" value="" style="width:100px">
                            <attachment owner-id="rooms.rooms_id ?rooms.rooms_id:1" owner-type="rooms" dhf-ng-model="rooms.img1" xtype="url" mult="false" title="Upload" use-type="png,jpeg,gif,jpg,JPG,PNG,JPEG,GIF"></attachment>
                        </label>
                    </li>
                    <li class="span2">
                        <div>
                            <div>
                                <img ng-src="{{rooms.img2}}" style="width:600px;height: 170px">
                            </div>
                            <label>
                                <br/> 链接：
                                <input ng-model="rooms.img2" type="text" name="name" value="" style="width:100px">
                                <attachment owner-id="rooms.rooms_id ?rooms.rooms_id:1" owner-type="rooms" dhf-ng-model="rooms.img2" xtype="url" mult="false" title="Upload" use-type="png,jpeg,gif,jpg,JPG,PNG,JPEG,GIF"></attachment>
                            </label>
                        </div>
                    </li>
                    <li class="span2">
                        <div>
                            <div>
                                <img ng-src="{{rooms.img3}}" style="width:600px;height: 170px">
                            </div>
                            <label>
                                <br/> 链接：
                                <input ng-model="rooms.img3" type="text" name="name" value="" style="width:100px">
                                <attachment owner-id="rooms.rooms_id ?rooms.rooms_id:1" owner-type="rooms" dhf-ng-model="rooms.img3" xtype="url" mult="false" title="Upload" use-type="png,jpeg,gif,jpg,JPG,PNG,JPEG,GIF"></attachment>
                            </label>
                        </div>
                    </li>
                    <li class="span2">
                        <div>
                            <div>
                                <img ng-src="{{rooms.img4}}" style="width:600px;height: 170px">
                            </div>
                            <label>
                                <br/> 链接：
                                <input ng-model="rooms.img4" type="text" name="name" value="" style="width:100px">
                                <attachment owner-id="rooms.rooms_id ?rooms.rooms_id:1" owner-type="rooms" dhf-ng-model="rooms.img4" xtype="url" mult="false" title="Upload" use-type="png,jpeg,gif,jpg,JPG,PNG,JPEG,GIF"></attachment>
                            </label>
                        </div>
                    </li>
                </ul>
                <div>
                    <input ng-model="rooms.img" type="hidden" value="" name="img" class="input-xlarge" required>
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top">{{'房间数量'| translate}}：</label>
            <div class="controls">
                <input ng-model="rooms.room_num" name="room_num" type="text" value="" class="input-xlarge">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top">{{'最长预约天数'| translate}}：</label>
            <div class="controls">
                <input ng-model="rooms.max_booking_days" name="max_booking_days" type="text" value="" class="input-xlarge">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top">{{'房间sku'| translate}}：</label>
            <div class="controls">
                <div ng-repeat="(key, value) in rooms.weekdays">
                    <label data-toggle="checkbox" class="checkbox-pretty inline {{value.son_data.length?'checked':''}} {{rooms.room_id && value.sku_id?'disabled':''}}">
                        <input type="checkbox" ng-click="isChecked($event,key)" ng-disabled="rooms.room_id&&value.sku_id" ng-checked="{{value.son_data.length? 'checked': ''}}" /><span>{{key=="0"?"周日":key=="1"?"周一":key=="2"?"周二":key=="3"?"周三":key=="4"?"周四":key=="5"?"周五":key=="6"?"周六":""}}</span>
                    </label>
                    
                    <div ng-if="value.son_data.length>0">
                        <table class="sui-table table-bordered-simple" style="width: 750px;margin-bottom: 0px;">
                            <tr>
                                <td style="width: 50%;">
                                    房间规格
                                </td>
                                <td>
                                    价格
                                </td>
                                <td>
                                    上下架
                                </td>
                                <td>
                                    操作
                                </td>
                            </tr>
                            <tr ng-repeat="son in value.son_data" style="border-top: 0px;">
                                <td style="width: 50%;">
                                    <!-- <input type="text" ng-model="son.tag_name1" data-toggle="timepicker"> 到
                                    <input type="text" ng-model="son.tag_name2" data-toggle="timepicker"> -->
                                    <roomtag ng-model="son.tag_name" tag_id="son.tag_id"></roomtag>
                                    <!-- <input type="text" ng-model="son.tag_name" /> -->
                                </td>
                                <td>
                                    <input value="" type="text" class="sui-input input-small" ng-model="son.price">
                                </td>
                                <td>
                                    <on-shelves ng-model="son.on_shelves" dft="1"></on-shelves>
                                </td>
                                <td>
                                    <button class="sui-btn btn-link" ng-click="tagDelete(rooms.room_id,son.sku_id,key,$index)"> 删除 </button>
                                </td>
                            </tr>
                        </table>
                        <div style="border-left: 1px solid #E6E6E6;border-right: 1px solid #E6E6E6;border-bottom: 1px solid #E6E6E6;">
                            <button class="sui-btn btn-link" ng-click="addTag(key)" style="margin-left: -10px;">增加房间规格</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top">{{'上架状态'| translate}}：</label>
            <div class="controls">
                <on-shelves ng-model="rooms.on_shelves" dft="1"></on-shelves>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top"> {{'房间描述'| translate}}：</label>
            <div class="controls">
                <ueditor ng-model="rooms.description" uid="roomsdescription" style="width:694px"></ueditor>
            </div>
        </div>
        <div class="control-group zhide">
            <label class="control-label v-top"> {{'特殊时间设置'| translate}}：</label>
            <div class="controls">
                {{rooms.special_time | json}}
                <div ng-repeat="(key, son) in rooms.special_time">
                    <div>
                        <table class="sui-table table-bordered-simple" style="width: 750px;margin-bottom: 0px;" ng-if="son.length>0">
                            <tr>
                                <td style="width: 50%;">
                                    特殊日期
                                </td>
                                <td>
                                    价格
                                </td>
                                <td>
                                    上下架
                                </td>
                                <td>
                                    操作
                                </td>
                            </tr>
                            <!-- ng-repeat="son in value.son_data"  -->
                            <tr style="border-top: 0px;">
                                <td style="width: 50%;">
                                    <input id="start_time" ng-model="son.special_time" datetimepicker name="start_time" value="2017-05-21 12:12:15" required>
                                </td>
                                <td>
                                    <input value="" type="text" class="sui-input input-small" ng-model="son.price">
                                </td>
                                <td>
                                    <on-shelves ng-model="son.on_shelves" dft="1"></on-shelves>
                                </td>
                                <td>
                                    <button class="sui-btn btn-link" ng-click="tagDelete(rooms.room_id,son.sku_id,key,$index)"> 删除 </button>
                                </td>
                            </tr>
                        </table>
                        <div style="border-left: 1px solid #E6E6E6;border-right: 1px solid #E6E6E6;border-bottom: 1px solid #E6E6E6;">
                            <button class="sui-btn btn-link" ng-click="addSpecialTime()" style="margin-left: -10px;">增加特殊时间</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"></label>
            <div class="controls">
                <button type="submit" id="submit" class="sui-btn btn-primary" ng-click="roomsAdd($event)">
                    <span>{{'save' | translate}}</span>
                </button>
            </div>
        </div>
    </form>
</div>